package com.zsp.coupon.feign;


import com.zsp.coupon.feign.hystrix.TemplateClentHystrix;
import com.zsp.coupon.vo.CommonResponse;
import com.zsp.coupon.vo.CouponTemplateSDK;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * 优惠卷模板微服务 Fegin  接口定义
 */

@FeignClient(value = "eureka-client-coupon-template",
                fallback = TemplateClentHystrix.class)
public interface TemplateClient {
    /**
     * 查找所有可用的优惠卷模板
     *
     * @return coupon-template网关设置的通用前缀+ template模板的controller
     */
    @RequestMapping(value = "/coupon-template/template/sdk/all",
            method = RequestMethod.GET)
    CommonResponse<List<CouponTemplateSDK>> findAllUsableTemplate();

    /**
     * 获取到模板的ids到 CouponTemplateSDK
     * @return
     */
    @RequestMapping(value = "/coupon-template/template/sdk/infos",
                            method = RequestMethod.GET)
    CommonResponse<Map<Integer,CouponTemplateSDK>> findIds2TemplateSDK(
            @RequestParam("ids") Collection<Integer> ids
    );


}